﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_MasterPages/layout.Master" AutoEventWireup="True" CodeBehind="RSAddProduct.aspx.cs" Inherits="mojoPortal.Web.RS.SBM.Telerik.Product.Add.RSAddProduct" %>
<%@ Register Src="~/RS/Controls/modalactionmessagecontrol.ascx" TagName="ModalActionMessageControl" TagPrefix="uc1" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="leftContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" runat="server">

<br />
<!-- content start -->

    
    <div id="divContent">
    <table width="100%">
    <tr>
    <td align="right" nowrap><asp:Label ID="lblWorkOrderEstimateID" runat="server" Text="WorkOrder ID:"></asp:Label></td>
    <td width="100%"><asp:TextBox ID="txtWorkOrderId" runat="server" Width="40px" ReadOnly="true" BackColor="Gainsboro"></asp:TextBox></td>
    </tr>
    <tr>
    <td align="right" nowrap valign="top">Selected Parts/Items:</td>
    <td>
   
    <div id="divSelectedParts" runat="server">
    <table width="60%"><tr><td>
     <fieldset>
    <asp:GridView ID="gvSelectedPartList" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ProductId" 
        OnRowDeleting="gvSelectedPartList_RowDeleting" ForeColor="#333333" GridLines="None" Width="100%">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:TemplateField HeaderText="">
        <ItemTemplate>
            <asp:LinkButton ID="lnkRemoveItem" CommandArgument='<%# Eval("ProductId") %>' CommandName="Delete" runat="server" CausesValidation="false">
            <asp:Image runat="server" ID="deleteImage" ImageUrl="~/RS/Images/removelink.gif" AlternateText="Delete" />
            </asp:LinkButton>
            <ajaxToolkit:ConfirmButtonExtender ID="Confirm_btnDeleteInventory" runat="server" TargetControlID="lnkRemoveItem" ConfirmText="Are you sure you want to remove this Item?" />
        </ItemTemplate>
        <HeaderStyle HorizontalAlign="Left" />
        </asp:TemplateField>
        <asp:BoundField DataField="ProductId" HeaderText="ProductID" InsertVisible="False" ReadOnly="True" SortExpression="ProductId" HeaderStyle-HorizontalAlign="Left" />
        <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" HeaderStyle-HorizontalAlign="Left"/>
        <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" HeaderStyle-HorizontalAlign="Left"/>
        
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
    <EmptyDataTemplate>
        <br />
        <center><asp:Label ID="lblNoRecordFound" runat="server" Text="No Parts/Items Have Been Added" Font-Bold="True" ForeColor="Silver"></asp:Label></center>
    </EmptyDataTemplate>
    </asp:GridView>
    <br />
    <asp:Button ID="btnSaveSelectedParts" runat="server" Text="Add Selected Parts" Visible="false" OnClick="btnSaveSelectedParts_Click" />
    </fieldset>
    </td></tr></table>
    </div>
    
    </td>
    </tr>
    </table>
    <br />
    <telerik:RadTreeList ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource"
        ParentDataKeyNames="ParentID" DataKeyNames="ProductID" AllowPaging="true" PageSize="25" 
        OnItemCommand="RadTreeList1_ItemCommand" 
        OnItemDataBound="RadTreeList1_ItemDataBound"
        AutoGenerateColumns="false" AllowSorting="true">
        <Columns>
            <telerik:TreeListSelectColumn UniqueName="SelectColumn"></telerik:TreeListSelectColumn>
            <telerik:TreeListBoundColumn DataField="ProductID" UniqueName="ProductID" HeaderText="ProductID" HeaderStyle-Width="60px" />
            <telerik:TreeListTemplateColumn DataField="ProductName" UniqueName="ProductName" HeaderText="ProductName">
                <ItemTemplate>
                    <asp:HyperLink ID="hlProductLink" runat="server" Text='<%# Eval("ProductName") %>'></asp:HyperLink>
                    <%# Eval("Quantity").ToString() != "" ? "&nbsp;(" + Eval("Quantity").ToString() + ")" : ""%>
                </ItemTemplate>
                
                <HeaderStyle Width="300px" />
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListBoundColumn DataField="Price" UniqueName="Price" DataFormatString="{0:C2}"
                HeaderText="Price" DataType="System.Decimal" HeaderStyle-Width="60px">
                <ItemStyle HorizontalAlign="Left" />
            </telerik:TreeListBoundColumn>
<%--            <telerik:TreeListBoundColumn DataField="Quantity" UniqueName="Quantity" HeaderText="Quantity" HeaderStyle-Width="60px">
                <ItemStyle HorizontalAlign="Left" />
            </telerik:TreeListBoundColumn>   --%>         
            <telerik:TreeListCheckBoxColumn DataField="InStock" UniqueName="InStock" HeaderText="InStock">
                <HeaderStyle Width="60px" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:TreeListCheckBoxColumn>

            <telerik:TreeListTemplateColumn UniqueName="Quantity" HeaderText="Quantity">
                <ItemTemplate>
                    <asp:TextBox ID="txtItemQuantity" runat="server" Width="30px" BackColor="Gainsboro" ReadOnly="true"></asp:TextBox>
                    <asp:Button ID="btnAddItem" runat="server" Visible="false" Text="Add" CommandName="Add" />
                </ItemTemplate>
                <HeaderStyle Width="100px"/>
            </telerik:TreeListTemplateColumn>

<%--            <telerik:TreeListBoundColumn DataField="ParentID" UniqueName="ParentID" HeaderText="ParentID" HeaderStyle-Width="60px">
                <ItemStyle HorizontalAlign="Left" />
            </telerik:TreeListBoundColumn>--%>
        </Columns>
    </telerik:RadTreeList>
    
    </div>
    <br /><br />
    <center><asp:Button ID="btnOK" runat="server" Text="OK" Visible="false" OnClick="btnOK_Click" /> </center>
    <uc1:ModalActionMessageControl ID="ucModalActionMessageControl" runat="server"/>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="rightContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="pageEditContent" runat="server">
</asp:Content>
